﻿/**********************************************************\
*  TinyLib - Node                                          *
*                                                          *
*  Base class for sprites.                                 *
*                                                          *
* (c) Jens Berglind                                        *
*                                                          *
* Last edited by Jens Berglind 25-06-2012                  *
\**********************************************************/ 

using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace TinyLib.Sprite
{
    public class Node : DrawableGameComponent
    {
       protected SpriteBatch spritebatch = null;

        public Vector2 position = Vector2.Zero;
        public Vector2 scale = new Vector2(1.0f, 1.0f);
        public Vector2 origin = Vector2.Zero;

        public List<Node> children = new List<Node>();

        public Node(SpriteBatch spritebatch, Game game)
            : base(game)
        {
            this.spritebatch = spritebatch;
        }

        public void Translate(Vector2 translate)
        {
            position += translate;
            foreach (Node node in children)
            {
                node.position += translate;
            }
        }
    }
}
